package com.project.lk.nurseapp.utils;

import com.google.gson.Gson;
import com.project.lk.nurseapp.base.BaseApi;
import com.project.lk.nurseapp.common.view.chat.IMMessage;
import com.project.lk.nurseapp.nurse.model.SendMsgBean;

import java.util.Date;

/**
 * 功能介绍：
 * 项目名：
 * 模块名称：
 * 作者：LK
 * 日期：2018/1/9
 * 修改日期：
 */
public class MessageCreateUtils {
/*发送文本消息*/
    public static IMMessage  sendTextMsg(String context,String direct,String senderType,String senderHeadImg,String sessionId,String senderNickname,String senderId){
        IMMessage imMessage=new IMMessage();
        imMessage.setContent(context);
        imMessage.setDirect(direct);
        imMessage.setSenderType(senderType);
        imMessage.setMsgType(BaseApi.text_type);
        imMessage.setSenderHeadImg(senderHeadImg);
        imMessage.setSenderNickName(senderNickname);
        imMessage.setSenderId(senderId);
        imMessage.setSessionId(sessionId);
        imMessage.setTime(String.valueOf(new Date().getTime()));
        return imMessage;
    }


    /*发送图片消息*/
    public  static IMMessage  sendImageMsg(String context,String direct,String senderType,String senderHeadImg,String sessionId,String senderNickname,String senderId){
        IMMessage imMessage=new IMMessage();
        imMessage.setContent(context);
        imMessage.setDirect(direct);
        imMessage.setSenderType(senderType);
        imMessage.setMsgType(BaseApi.image_type);
        imMessage.setSenderHeadImg(senderHeadImg);
        imMessage.setSenderNickName(senderNickname);
        imMessage.setSenderId(senderId);
        imMessage.setSessionId(sessionId);
        imMessage.setTime(String.valueOf(new Date().getTime()));
        return imMessage;
    }

    /*发送音频消息*/
    public  static IMMessage  sendAudioMsg(String context,String direct,String senderType,String senderHeadImg,String sessionId,String senderNickname,String senderId){
        IMMessage imMessage=new IMMessage();
        imMessage.setContent(context);
        imMessage.setDirect(direct);
        imMessage.setSenderType(senderType);
        imMessage.setMsgType(BaseApi.audio_type);
        imMessage.setSenderHeadImg(senderHeadImg);
        imMessage.setSenderNickName(senderNickname);
        imMessage.setSenderId(senderId);
        imMessage.setSessionId(sessionId);
        imMessage.setTime(String.valueOf(new Date().getTime()));
        return imMessage;
    }

    /*发送视频消息*/
    public  static IMMessage  sendVideoMsg(String context,String direct,String senderType,String senderHeadImg,String sessionId,String senderNickname,String senderId){
        IMMessage imMessage=new IMMessage();
        imMessage.setContent(context);
        imMessage.setDirect(direct);
        imMessage.setSenderType(senderType);
        imMessage.setMsgType(BaseApi.video_type);
        imMessage.setSenderHeadImg(senderHeadImg);
        imMessage.setSenderNickName(senderNickname);
        imMessage.setSenderId(senderId);
        imMessage.setSessionId(sessionId);
        imMessage.setTime(String.valueOf(new Date().getTime()));
        return imMessage;
    }

    public static String getWebJson(Gson gson,String content,String msgType,String sendType){
        SendMsgBean sendMsgBean=new SendMsgBean();
        sendMsgBean.setMsgType(msgType);
        sendMsgBean.setSessionId((String)SharedPreferencesUtils.getParam("sessionId",""));
        sendMsgBean.setContent(content);
        sendMsgBean.setSenderType(sendType);
        return gson.toJson(sendMsgBean);
    }

    /*发送不同类型的消息*/
    public static IMMessage  sendMsg(String context,String direct,String msgType,String senderType,String senderHeadImg,String sessionId,String senderNickname,String senderId){
        IMMessage imMessage=new IMMessage();
        imMessage.setContent(context);
        imMessage.setDirect(direct);
        imMessage.setSenderType(senderType);
        imMessage.setMsgType(msgType);
        imMessage.setSenderHeadImg(senderHeadImg);
        imMessage.setSenderNickName(senderNickname);
        imMessage.setSenderId(senderId);
        imMessage.setSessionId(sessionId);
        imMessage.setTime(String.valueOf(new Date().getTime()));
        return imMessage;
    }
}
